import { Controller, Get, Query, Param } from '@nestjs/common';
import { AppWebService } from './app.service';
import { ApiTags } from '@nestjs/swagger';

@ApiTags('App、Web看帖模块')
@Controller('app')
export class AppWebController {
  constructor(private readonly appWebService: AppWebService) {}

  // 查询帖子列表
  @Get('/queryPostList')
  queryPostList(
    @Query('pageSize') pageSize = 10,
    @Query('pageIndex') pageIndex = 0,
  ) {
    return this.appWebService.queryPostListByPage(pageSize, pageIndex);
  }

  // 查询帖子详情
  @Get('/queryPostDetail/:postId')
  queryPostDetail(@Param('postId') postId: string) {
    if (!postId) {
      return {
        data: {},
        msg: '查询参数为空',
      };
    }
    return this.appWebService.queryPostDetailById(postId);
  }
}
